layui.form.verify({
    pwd: [/^\S{6,12}$/, '密码长度必须是6-12位'],
    repwd: function (value) {
        var pwd = $('[name = "newPwd"]').val();
        if (pwd != value) {
            return '密码不一致'
        }
    }
})

// 实现密码重置功能
$('#myform').on('submit', function (e) {
    e.preventDefault()
    console.log($('[name="newPwd"]').val())
    console.log($('#myfom').serialize())
    $.ajax({
        method: 'post',
        url: '/my/updatepwd',
        data: $('#myfom').serialize(),
        success: function (res) {
            localStorage.removeItem('token')
            window.parent.location.href = '/login.html'
        }
    })
})